package com.mu.securitysso.service;

import com.mu.securitysso.dao.PermissionDao;
import com.mu.securitysso.dao.RoleDao;
import com.mu.securitysso.dao.UserDao;
import com.mu.securitysso.entity.Permission;
import com.mu.securitysso.entity.Role;
import com.mu.securitysso.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sht
 */
@Service
public class SecurityDataService {

    @Autowired
    private UserDao userDao;

    @Autowired
    private RoleDao roleDao;

    @Autowired
    private PermissionDao permissionDao;


    public User findSUserByName(String name) {
        return userDao.findUserByName(name);
    }

    public List<Role> findSRoleListBySUserId(int sUserId) {
        return roleDao.findRoleListByUserId(sUserId);
    }
    public List<Role> findSRoleListBySPermissionUrl(String sPermissionUrl) {
        return roleDao.findRoleListByPermissionUrl(sPermissionUrl);
    }

    public List<Permission> findSPermissionListBySUserId(int sUserId) {
        return permissionDao.findPermissionListByUserId(sUserId);
    }

    public List<Permission> findSPermissionListBySPermissionUrl(String sPermissionUrl) {
        return permissionDao.findPermissionListByPermissionUrl(sPermissionUrl);
    }


}
